﻿using MiniFox.Resources;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;

namespace MiniFox.Platform.OAuth2.Models
{
    /// <summary>
    /// 重置密码请求模型
    /// </summary>
    [JsonObject]
    public class ChangePassword
    {
        /// <summary>
        /// 原密码
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(CommonMessages), ErrorMessageResourceName = "MSG_CommonRequired")]
        [DataType(DataType.Password)]
        [Display(Name = "LAB_OldPwd", Prompt = "LAB_OldPwd", ResourceType = typeof(Resources.ResMessage))]
        [RegularExpression(GlobalKey.REGEX_SECURE_PASSWORD, ErrorMessageResourceType = typeof(CommonMessages), ErrorMessageResourceName = "MSG_CommonUnmatchRegex")]
        [JsonProperty("password")]
        public string Password { get; set; }
        /// <summary>
        /// 新密码
        /// </summary>
        [Required(ErrorMessageResourceType = typeof(CommonMessages), ErrorMessageResourceName = "MSG_CommonRequired")]
        [Display(Name = "LAB_NewPwd", Prompt = "LAB_NewPwd", ResourceType = typeof(Resources.ResMessage))]
        [SecureString(SecureStringType.Password, ErrorMessageResourceType = typeof(CommonMessages), ErrorMessageResourceName = "MSG_CommonUnmatchRegex")]
        [JsonProperty("newPassword")]
        public string NewPassword { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Compare("NewPassword", ErrorMessageResourceType = typeof(Resources.ResMessage), ErrorMessageResourceName = "ERR_UnmatchConfirmPassword")]
        [Display(Name = "LAB_ConfirmPwd", Prompt = "LAB_ConfirmPwd", ResourceType = typeof(Resources.ResMessage))]
        [JsonProperty("confirmPassword")]
        public string ConfirmPassword { get; set; }
        
    }
}
